<template>
	<view class="center">
		<view class="logo" @click="goLogin" :hover-class="!login ? 'logo-hover' : ''">
			<image class="logo-img" v-if="uerInfo!=null" :src="globals+uerInfo.icon"></image>
			<view class="logo-title">
				<text class="uer-name">Hi，{{login ? uerInfo.username : '您未登录'}}</text>
				<text class="go-login navigat-arrow" v-if="!login">&#xe65e;</text>
			</view>
		</view>
		<view class="center-list">
			<view class="center-list-item border-bottom" @click="manage">
				<text class="list-icon">&#xe60f;</text>
				<text class="list-text">帐号管理</text>
				<text class="navigat-arrow">&#xe65e;</text>
			</view>
			<view class="center-list" @click="chongzhi">
				<view class="center-list-item">
					<text class="list-icon">&#xe614;</text>
					<text class="list-text">充值</text>
					<text class="navigat-arrow">&#xe65e;</text>
				</view>
			</view>
			<view class="center-list-item" @click="jump('/pages/center/follow','navigateTo')">
				<text class="list-icon">&#xe639;</text>
				<text class="list-text">关注列表</text>
				<text class="navigat-arrow">&#xe65e;</text>
			</view>
			<view class="center-list-item" @click="jumps(2)">
				<text class="list-icon">&#xe639;</text>
				<text class="list-text">收藏列表</text>
				<text class="navigat-arrow">&#xe65e;</text>
			</view>
			<view class="center-list-item" @click="jumps(1)">
				<text class="list-icon">&#xe639;</text>
				<text class="list-text">购买记录</text>
				<text class="navigat-arrow">&#xe65e;</text>
			</view>
			<view class="center-list-item" @click="jump('/pages/center/follows','navigateTo')">
				<text class="list-icon">&#xe639;</text>
				<text class="list-text">商铺列表</text>
				<text class="navigat-arrow">&#xe65e;</text>
			</view>
			<view class="center-list-item" @click="jump('/pages/goods-list/goods-list','navigateTo')">
				<text class="list-icon">&#xe639;</text>
				<text class="list-text">商品管理</text>
				<text class="navigat-arrow">&#xe65e;</text>
			</view>
		</view>
		<view class="center-list">
			<view class="center-list-item border-bottom" v-if="uerInfo.role == '1'"
				@click="jump('/pages/center/examine','navigateTo')">
				<text class="list-icon">&#xe60b;</text>
				<text class="list-text">入驻审核</text>
				<text class="navigat-arrow">&#xe65e;</text>
			</view>
			<view class="center-list-item border-bottom" v-if="uerInfo.role ==  '0'"
				@click="jump('/pages/center/ruzhu','navigateTo')">
				<text class="list-icon">&#xe60b;</text>
				<text class="list-text">商家入驻</text>
				<text class="navigat-arrow">&#xe65e;</text>
			</view>
			<view class="center-list-item" @click="jump('/pages/center/bianji','navigateTo')">
				<text class="list-icon">&#xe65f;</text>
				<text class="list-text">商户信息编辑</text>
				<text class="navigat-arrow">&#xe65e;</text>
			</view>
		</view>
		<view class="center-list" @click="change">
			<view class="center-list-item">
				<text class="list-icon">&#xe614;</text>
				<text class="list-text">修改密码</text>
				<text class="navigat-arrow">&#xe65e;</text>
			</view>
		</view>
	</view>
</template>

<script>
	import apis from '@/api/index.js'
	import G from '@/config/global.js'
	import {
		requestApi
	} from '@/utils/request.js'
	// 导入公共组件方法
	import common from '@/common/js/common.js';
	export default {
		mixins: [common],
		data() {
			return {
				login: false,
				avatarUrl: "../../static/uni-center/logo.png",
				uerInfo: {},
				globals: ''
			}
		},
		onLoad() {
			this.uerInfo = uni.getStorageSync("user");
			if (this.uerInfo.userId != null) {
				this.login = true;

			}
			this.globals = G.REQUEST_URL
			console.log(this.globals)
		},
		methods: {
			jumps(e) {
				uni.navigateTo({
					url: "/pages/index/shoucang?type=" + e
				})
			},
			goLogin() {
				if (!this.login) {
					console.log("点击前往登录")
					uni.navigateTo({
						url: "/pages/login/login"
					})
				} else {
					uni.navigateTo({
						url: "/pages/center/info/info"
					})
				}
			},
			manage() {
				uni.navigateTo({
					url: "/pages/center/manage"
				})
			},
			chongzhi(){
			uni.navigateTo({
				url:"/pages/center/chongzhi"
			})	
			},
			change() {
				uni.navigateTo({
					url: "/pages/center/password"
				})
			}
		}
	}
</script>

<style>
	@font-face {
		font-family: texticons;
		font-weight: normal;
		font-style: normal;
		src: url('https://at.alicdn.com/t/font_984210_5cs13ndgqsn.ttf') format('truetype');
	}

	page, 
	view {
		display: flex;
	}

	page {
		background-color: #f8f8f8;
	}

	.center {
		flex-direction: column;
	}

	.logo {
		width: 750upx;
		height: 240upx;
		padding: 20upx;
		box-sizing: border-box;
		background-color: #4cd964;
		flex-direction: row;
		align-items: center;
	}

	.logo-hover {
		opacity: 0.8;
	}

	.logo-img {
		width: 150upx;
		height: 150upx;
		border-radius: 150upx;
	}

	.logo-title {
		height: 150upx;
		flex: 1;
		align-items: center;
		justify-content: space-between;
		flex-direction: row;
		margin-left: 20upx;
	}

	.uer-name {
		height: 60upx;
		line-height: 60upx;
		font-size: 38upx;
		color: #FFFFFF;
	}

	.go-login.navigat-arrow {
		font-size: 38upx;
		color: #FFFFFF;
	}

	.login-title {
		height: 150upx;
		align-items: self-start;
		justify-content: center;
		flex-direction: column;
		margin-left: 20upx;
	}

	.center-list {
		background-color: #FFFFFF;
		margin-top: 20upx;
		width: 750upx;
		flex-direction: column;
	}

	.center-list-item {
		height: 90upx;
		width: 750upx;
		box-sizing: border-box;
		flex-direction: row;
		padding: 0upx 20upx;
	}

	.border-bottom {
		border-bottom-width: 1upx;
		border-color: #c8c7cc;
		border-bottom-style: solid;
	}

	.list-icon {
		width: 40upx;
		height: 90upx;
		line-height: 90upx;
		font-size: 34upx;
		color: #4cd964;
		text-align: center;
		font-family: texticons;
		margin-right: 20upx;
	}

	.list-text {
		height: 90upx;
		line-height: 90upx;
		font-size: 34upx;
		color: #555;
		flex: 1;
		text-align: left;
	}

	.navigat-arrow {
		height: 90upx;
		width: 40upx;
		line-height: 90upx;
		font-size: 34upx;
		color: #555;
		text-align: right;
		font-family: texticons;
	}
</style>